AN009 - Example of using and calibrating the OOPOS3 device

In this section you want to describe the first operations that you will be doing the user in his first approach with the EANPOS device. You also want to provide a simple example where using the OOPOS3 device to implement a positioner.

We can divide the procedure into the following sections:

Device declaration in the configuration unit

As has already been explained in the Description section of the OOPOS3 device, You must program correctly the configuration unit of the application. It is very important that the code portion where device is declared, here you will need to indicate the hardware resources to be used to ensure proper operation. It will be the task of the programmer to identify and choose the most appropriate inputs and outputs. For example, with the following line of code:

;--------------------------------- 
; Internal device declaration 
;--------------------------------- 
INTDEVICE 
Axis  OOPOS3  0004  2.CNT01 1 3.INP01 2.OUT01 2.OUT02 X.X X.X 2.OUT3  X.X

You define a OOPOS3 device with the name “axis” whose sampling time is 4 ms. Have been declared the following hardware resources: the input of the bidirectional counter, the digital input number for interruption dedicated to the encoder zero pulse, a digital input of enabling for the acquisition of the zero pulse. The movement outputs that have been declared are: 2.OUT01 as forward output, 2.OUT02 as backward output and 2.OUT03 as slow-down output.

An application that only has the device declaration within the configuration unit and a QCL unit that does not execute any operation (Except WAIT forced) It already allows you to do the first steps using the features of the device. After you download the application on the instrument and having it run, you will can already change the parameters, observe the states or give commands to the device via the monitor provided by Qview.
This is very convenient in the early stages of programming when you just want to check for some operations or when you're debugging.

Connecting the hardware

The OOPOS3 device requires some hardware resources such as an input counter for two-way transducer (CNTxx) and the digital outputs.

Verifying how the Counter resource works

The following procedure is used to verify the operation of the counter input.

Verifica del funzionamento delle uscite digitali

:important:Attention:
Before handling the axis, verify proper operation of emergency equipment and protection.

The following procedure is used to verify the operation of the digital outputs of forward, backward and slow-down moving the axis with manual device controls.
To continue, verify that the Axis device is initialized and with the measure and pulse value correct.

Correct parameterization of the device

After you correctly declare the hardware resources to use you must set some parameters based on the components that are attached to the Qmove product.

Measure and pulse introduction

Let us consider the case In which the bidirectional transducer is a digital encoder. Suppose that the encoder is directly keyed on a motor that must move the axis. You will need to set correctly the measure and pulseparameters of the device so that it can interpret the pulses arriving at QMove, the instrument will then calculate the position of the axis. The measure and pulse introduction Establishes a match between a space in a selected unit of measure and a certain number of pulses. In the event that the user already knows the path space in a encoder round Then you can proceed directly to the input of the values.
We clarify this concept with an example: If the encoder generates 1000 pulses turn and you know that the axis moves about 5 cm when the encoder execute a complete precisely round then you can enter the following values:

AxisX:measure = 50;
AxisX:pulse = 4000

The measure value introduced It also implies the choice of a unit of measure of millimeter to measure the positions, in the pulse parameter A value equal to the number of encoder pulses has been introduced multiplied x 4. You remember that the measure/pulse ratio must have a value between 0.00935 and 1. It is important to emphasize that the values just described are taken as a reference: it's not necessary to introduce the parameters taking as reference an encoder lap as you will describe below.

When the user does not know in advance the measurement parameters, you can still correct the calibration by following these steps:

The encoder resolution is now correctly set.

A further important task to do is set the maxpos and minpos parameters that respectively, define the maximum and minimum position to be reached by the axis.

Choosing the speed measurement unit

The unit of measurement of the instantaneous axis speed is chosen using the unitvel and decpt parameters. You can choose the speed time unit with the unitvel parameter: if this is 0 the speed is measured in Um/min, if is to 1 is measured in Um/s. The decpt parameter Instead it determines whether to measure the speed values in multiples of the fundamental unit of measure Um. For example, if the fundamental unit of measure Um=mm, and unitvel=1 You get the speed show in the vel in variable:
mm/s (with decpt = 0),
cm/s (with decpt = 1),
dm/s (with decpt = 2),
m/s (with decpt = 3).
Later, if necessary, you should to properly configure the display on the operator terminal to adjust the correct position of the decimal point.

Basic parameterizations

To operate the device OOPOS3 properly, you must enter some basic parameters.

Impostazione parametro maxvel

Se non si è a conoscenza della velocità massima dichiarata del motore si deve procedere in questo modo:

Ora è quindi possibile introdurre il valore della velocità massima nel parametro maxvel

Movimentazione

Le procedure fin qui descritte hanno permesso di completare le fasi di definizione delle risorse hardware necessarie al device, di verifica dei collegamenti elettrici, di impostazione dei parametri fondamentali del device.
Ora è possibile eseguire una semplice movimentazione dell'asse.

Sviluppo di un applicativo che implementi un posizionatore

Nella sezione precedente è stato spiegato quali sono i primi passi da seguire per una procedura di movimentazione di un asse. Tale esempio impiega solo un ristretto spettro dei parametri impostabili del device, in questa sezione inseriamo un codice di esempio, dettagliatamente commentato, da cui l'utilizzatore può prendere spunto per sviluppare un applicativo.
Il modo in cui il device va dichiarato è spiegato precedentemente, e perciò in questa sezione è omessa la unit di configurazione. Vedi qui.

;*************************************************************************************
; Unit di configurazione (sono riportate solo le dichiarazioni di variabili e 
; sono omesse le dichiarazioni del bus e del device)
;*************************************************************************************
;-------------------------------------------------------------------------------------
; Definizione Variabili SYSTEM
;-------------------------------------------------------------------------------------
SYSTEM
slQuotaPos L                  ;Variabile per quota di posizionamento
;-------------------------------------------------------------------------------------
; Definizione Variabili GLOBAL
;-------------------------------------------------------------------------------------
GLOBAL
gfMovMan F                    ;Flag segnalazione movimenti manuali in corso
gfMovAuto F                   ;Flag segnalazione movimenti automatici in corso
;-------------------------------------------------------------------------------------
; Definizione Variabili INPUT
;-------------------------------------------------------------------------------------
INPUT
ifAvMan F 2.INP01             ;Ingresso di avanti manuale
ifInMan F 2.INP02             ;Ingresso di indietro manuale
ifStart F 2.INP03             ;Ingresso di START asse
ifStop  F 2.INP04             ;Ingresso di STOP asse
;-------------------------------------------------------------------------------------
; Definizione Variabili OUTPUT
;-------------------------------------------------------------------------------------
OUTPUT
ofToll F 2.OUT01              ;Uscita di asse in tolleranza
 
;*************************************************************************************
; Unit qcl
;*************************************************************************************
;-------------------------------------------------------------------------------------
; Operazioni di parametrizzazione del device
;-------------------------------------------------------------------------------------
Asse:measure = 10000        
Asse:pulse = 40000            ;come calcolare measure e pulse è spiegato nel paragrafo apposito.*
Asse:maxvel = 100000          ;come calcolare maxvel è spiegato nel paragrafo apposito.*
Asse:maxpos = 999999          ;Quota massima
Asse:minpos = -999999         ;Quota minima
Asse:slowpos = 100            ;Quota di rallentamento
Asse:tollp = 10               ;Tolleranza positiva
Asse:tolln = 50               ;Tolleranza negativa
Asse:slowdly = 50             ;Tempo di rallentamento
Asse:tbrake = 30              ;Tempo di intervento freno
Asse:overpos = 0              ;Oltrequota recupero giochi
Asse:bklashmode = 0           ;Modalità recupero giochi
Asse:ninert = 1               ;Numero fasce d'inerzia
Asse:maxiner = 100            ;Massima inerzia dopo ricalcolo
Asse:inertmode = 1            ;Modalità ricalcolo inerzia
Asse:tool = 0                 ;Spessore utensile
Asse:dobiner = 0              ;Modalità inerzia avanti/indietro
Asse:enstol = 0               ;Abilitazione START con asse in tolleranza
Asse:unitvel = 0              ;Unità di tempo della velocità (velocità in Um/min)
Asse:decpt = 0                ;Cifre decimali nel calcolo della velocità
Asse:tinv = 50                ;Tempo di inversione asse
Asse:toll = 5                 ;Tolleranza (impostata in Um)
Asse:toldly = 10              ;Tempo di ritardo attivazione stato di tolleranza
Asse:prsmode = 0              ;Modalità di funzione di homing
Asse:prspos = 0               ;Homing offset
Asse:prsdir = 0               ;Direzione di movimento per la ricerca di posizione di home
Asse:prsvel = (20 * Asse:maxvel)/100  ;Velocità per la ricerca di attivazione ingresso digitale di abilitazione (20% della vel.max.)
Asse:sprsvel = (10 * Asse:maxvel)/100 ;Velocità per la ricerca della posizione di home (10% della vel.max.)
Asse:breaktype = 0            ;Logica di intervento del freno
Asse:slowtype = 0             ;Tipo di calcolo rallentamento
Asse:maxslow = 8              ;Rallentamento calcolato massimo
Asse:minslow = 80             ;Rallentamento calcolato minimo
 
INIT Asse                     ;Inizializza il device
WAIT Asse:st_init             ;Attendi che il device sia inizializzato
CNTUNLOCK Asse                ;Sblocca acquisizione posizione
WAIT NOT Asse:st_cntlock      ;Attendi che l'acquisizione della posizione sia sbloccato
CNTDIR Asse                   ;Imposta il senso dell'acquisizione di posizione
WAIT NOT Asse:st_cntrev       ;Attendi che sia impostato il senso dell'acquisizione di posizione
REGON Asse                    ;Abilita la regolazione
WAIT NOT Asse:st_regoff       ;Attendi l'abilitazione alla regolazione
 
IF (slQuotaPos EQ 0)          ;Nel caso in cui la quota di posizionamento dell'asse sia zero
  slQuotaPos = 2000           ;Imposta una quota di posizionamento
ENDIF
 
;-------------------------------------------------------------------------------------
; Operazioni di Posizionamento
;-------------------------------------------------------------------------------------
; ------------------------------- variabili utilizzate ------------------------------
; slQuotaPos: Variabile impostabile che rappresenta la quota di posizionamento dell'asse
; ---------------------------------- flag utilizzati --------------------------------
; gfMovMan:   Movimento manuale in corso
; gfMovAuto:  Movimento automatico in corso
;-------------------------------------------------------------------------------------
 
MAIN:
;-------------------------------------------------------------------------------------
; Gestione uscite
;-------------------------------------------------------------------------------------
ofToll = Asse:st_toll         ;Imposto l'uscita di tolleranza come lo stato di tolleranza
 
;-------------------------------------------------------------------------------------
; Gestione movimenti automatici
;-------------------------------------------------------------------------------------
IF ifStart                          ;Attende l'ingresso di START
  IF NOT gfMovMan                   ;Controlla che non ci siano movimenti manuali
    IF Asse:st_still                ;Controlla che l'asse sia fermo
      Asse:setpos = slQuotaPos      ;Imposta la quota di posizionamento
      START Asse                    ;Esegue lo start dell'asse
      gfMovAuto = 1                 ;Segnala movimento automatico in corso
    ENDIF
  ENDIF
ENDIF
IF ifStop                           ;Attende l'ingresso di STOP
  IF NOT Asse:st_still              ;Controlla che l'asse NON sia fermo
    STOP Asse                       ;Esegue lo stop dell'asse
  ENDIF
ENDIF
IF gfMovAuto                        ;Controlla segnalazione movimento automatico in corso
  IF Asse:st_still                  ;Controlla che l'asse sia fermo
    gfMovAuto = 0                   ;Resetta stato di movimento Automatico
  ENDIF
ENDIF
 
;-------------------------------------------------------------------------------------
; Gestione movimenti manuali (JOG)
;-------------------------------------------------------------------------------------
IF ifAvMan                          ;Attende l'ingresso di movimento manuale
  IF NOT (gfMovAuto OR gfMovMan)    ;Controlla che non ci siano movimenti automatici o manuali in corso
    IF Asse:st_still                ;Controlla che l'asse sia fermo
      MANFFW Asse                    ;Avanti asse in manuale
      gfMovMan = 1                  ;Segnala movimento manuale in corso
    ENDIF
  ENDIF
ENDIF
IF ifInMan                          ;Attende l'ingresso di movimento manuale
  IF NOT (gfMovAuto OR gfMovMan)    ;Controlla che non ci siano movimenti automatici o manuali in corso
    IF Asse:st_still                ;Controlla che l'asse sia fermo
      MANFBW Asse                    ;Avanti asse in manuale
      gfMovMan = 1                  ;Segnala movimento manuale in corso
    ENDIF
  ENDIF
ENDIF
IF gfMovMan                         ;Se l'asse si muove in manuale
  IF NOT (ifAvMan OR ifInMan)       ;Se gli ingressi di avanti e indietro manuale sono OFF
    STOP Asse                       ;Ferma l'asse
    gfMovMan = 0                    ;Togli la segnalazione di asse in movimento manuale
  ENDIF
ENDIF
 
;-------------------------------------------------------------------------------------
; Operazioni finali
;-------------------------------------------------------------------------------------
WAIT 1
JUMP MAIN
END

Come calcolare measure e pulse è spiegato nel paragrafo apposito.